﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CrankShaftAnalysisSystem
{
    public class UIHelper
    {
        public static void SetPanelToCenter(ref Panel panel)
        {
            var c = panel.Parent as ContainerControl;
            if (c is null) return;
            var center_x = c.Width / 2;
            var cetner_y = c.Height / 2;
            var new_location = panel.Location;
            new_location.X = center_x - panel.Width / 2;
            new_location.Y = cetner_y - panel.Height / 2;
            panel.Location = new_location;
            panel.Refresh();
        }
    }
}
